#include <iostream>
#include <vector>
#include <queue>
#include <tuple>
#include <algorithm>
#include <cmath>
#include <cfloat>
#include <iomanip>
using namespace std;

int main()
{
        int n;
        cin >> n;
        vector<vector<int>> gh(n + 1);
        vector<pair<int, int>> points;
        points.push_back({0, 0});
        for(int i = 1; i <= n; i++){
                int x, y;
                cin >> x >> y;
                points.push_back({x, y});
        }

        int m;
        cin >> m;
        for(int i = 0; i < m; i++){
                int u, v;
                cin >> u >> v;
                gh[u].push_back(v);
                gh[v].push_back(u);
        }

        int start, end;
        cin >> start >> end;

        vector<double> dis(n + 1, DBL_MAX);
        vector<int> vis(n + 1, 0);
        queue<tuple<int, int>> q;
        dis[start] = 0;
        priority_queue<tuple<double, int>, vector<tuple<double, int>>, greater<>> pq;
        pq.emplace(0, start);

        while(!pq.empty()){
                auto [w, u] = pq.top();
                pq.pop();
                if(vis[u]){
                        continue;
                }
                vis[u] = 1;

                for(auto v : gh[u]){
                        if(vis[v]){
                                continue;
                        }
                        double d = pow(abs(points[u].first - points[v].first), 2);
                        d += pow(abs(points[u].second - points[v].second), 2);
                        d = sqrt(d) + w;
                        if(d < dis[v]){
                                dis[v] = d;
                                pq.emplace(d, v); 
                        }
                }
        }
        cout<<setiosflags(ios::fixed)<<setprecision(2)<<dis[end]<<endl;
        return 0;
}